
//显示帮手设置面板
function showSetAssistantDiv(_userId) {
	$("#setAssistant_userId").attr("value",_userId);
	$("#setAssistantCommunity").show();
	
}

//设置帮手地址
function setAssistantCommunity() {
	var _city = $("#setAssistant_city").val();
	var _county = $("#setAssistant_county").val();
	var _community = $("#setAssistant_community").val();
	var _userId = $("#setAssistant_userId").val();
	//type 0 添加地址 1删除地址
	$.post(ctx+"/user/set.assistant",{userId:_userId,type:0,city:_city,county:_county,community:_community},function(data){
		if(data&&data.status==200){
			alert(data.message);
		}
	});
}

//显示取消帮手地址面板
function showAssistantAddressPanel(_userId) {
	$("#removeAssistant_userId").attr("value",_userId);
	$("#removeAssistantCommunity").show();
	$.post(ctx+"/user/get",{userId:_userId},function(data){
		if(data&&data.status==200){
			var address=data.result.assistantAddress;
			for(var i=0;i<address.length;i++){
				var community=address[i].community;
				$("#removeAssistantSelect").append("<option value="+community+">"+community+"</option>");
			}
		}else{
			alert(data.message);
		}
	});
	
	
}

//取消帮手
function cancelAssistant() {
	var _userId=$("#removeAssistant_userId").val();
	var _community=$("#removeAssistantSelect").val();
	//type 0 添加地址 1删除地址
	$.post(ctx+"/user/set.assistant",{type:1,userId:_userId,community:_community},function(data){
		if(data&&data.status==200){
			alert(data.message);
		}
	});
}